package fr.afcepf.atod19.web.mbean;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;

import fr.afcepf.atod19.voyage.entities.Client;
import fr.afcepf.atod19.voyage.entities.Voyage;
import fr.afcepf.atod19.voyage.facade.FacadeAdminGestionUtilisateur;
import fr.afcepf.atod19.voyage.facade.FacadeAdminGestionVoyage;
import fr.afcepf.atod19.voyage.facade.FacadeUtilisateur;
import fr.afcepf.atod19.voyage.service.interfaces.IServiceUtilisateur;

@ManagedBean
public class BackVoyageBean {
	
	
	@ManagedProperty(value="#{facadeAdminGestionVoyage}")
	private FacadeAdminGestionVoyage facadeAdminGestionVoyage;
	
	private List<Voyage> voyages = new ArrayList<Voyage>();
	
		
	private String destination;

	private String description;
	

	

	public FacadeAdminGestionVoyage getFacadeAdminGestionVoyage() {
		return facadeAdminGestionVoyage;
	}

	public void setFacadeAdminGestionVoyage(
			FacadeAdminGestionVoyage facadeAdminGestionVoyage) {
		this.facadeAdminGestionVoyage = facadeAdminGestionVoyage;
	}

	public List<Voyage> getVoyages() {
		return voyages;
	}

	public void setVoyages(List<Voyage> voyages) {
		this.voyages = voyages;
	}

	public String getDestination() {
		return destination;
	}

	public void setDestination(String destination) {
		this.destination = destination;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
	
	
	@PostConstruct
	public void Accueil() {
		Voyage v = null;
		voyages = facadeAdminGestionVoyage.rechercherVoyage(v);

	}
	
	
	

	public String rechercherVoyages() {
		System.out.println("BackVoyageBean.rechercherVoyages()");
		
		
		Voyage v = null;

		System.out.println("Destination : ");
		System.out.println(destination);

		if (destination != "") {
			v = new Voyage();
			v.setDestination(destination);
		}

		voyages = facadeAdminGestionVoyage.rechercherVoyage(v);

		System.out.println("liste size : " +voyages.size());
		
		

		return "";
	}



	
	
	





	public String actionTest(){
				
		System.out.println( "BackVoyageBean:actionTest() "  );

		
		return "";
	}
	
	

	
	
	
	

}
